/**
 * @file TEST_filter_algo.c
 * @author Linquan  
 * @brief  这些滤波算法，暂时用不到，也不是很适合封装成模块。以后用到再说
 * @version 1.0
 * @date 2024-08-01
 * 
 * @copyright Copyright (c) 2024
 * 
 */



#include "app_config.h"
#if TEST_FILTER_ALGO


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include "filter_algo.h"


int random_generator(int limit_min, int limit_max)
{
    int value = 0;
    srand((unsigned)time(NULL));
    value = limit_min + (rand()%(limit_max - limit_min +1));
    return value;
}



#define MAX 315
#define MIN 290
#define STAND_VALUE 300     /* 基准值 */
#define LIMIT_RANGE 5       /* 限幅范围 */

int get_ad()
{
    random_generator(MIN,MAX);
}



/**
 * @brief 限幅滤波
 * 
 */
void TEST_Limit_filter()
{   
    int n = 10;
    int temp_value , last_value = 0;
    while (n)
    {
        n--;
        temp_value = get_ad();
        printf("real_value :%d, \n",temp_value);

        printf(" middle filter value :%d, \n",Limit_Filter_middle(temp_value, last_value, LIMIT_RANGE));
        last_value = temp_value;

        printf(" edge filter value :%d, \n",Limit_Filter_edge(temp_value, MAX, MIN));
        sleep(1);
    } 
}
EXPORT_Lv6_APP_SINGLE(TEST_Limit_filter,NULL);





















#endif



